def sis():
    global r,x,y,o,g,t,h,t,m,cuowu,cuo
    import time,random
    r = 0
    x = 0
    y = 0
    o = 0
    g = 6   #告诉程序一共听写几次
    m = 0
    cuo = 0
    t = {}
    h = {}
    t = {}
    cuowu = {}
    yi = {'classroom':'教室','window':'窗户','blackboard':'黑板','light':'电灯','picture':'图画','door':'门',"teacher's desk":"讲台",'computer':'计算机','fan':'风扇','wall':'墙壁','floor':'地板','really':'（表示兴趣或惊讶）真的','near':'距离近','TV':'电视','clean':'打扫','help':'帮助'}
    er = {'schoolbag':'书包','maths book':'数学书','English book':'英语书','Chinese book':'语文书','storybook':'故事书','candy':'糖果','notebook':'笔记本','toy':'玩具','key':'钥匙','wow':'哇；呀','lost':'丢失（lose的过去式形式）','so much':'非常地','cute':'可爱的'}
    san = {'strong':'强壮的','friendly':'友好的','quiet':'安静的','hair':'头发','shoe':'鞋','glasses':'眼镜','his':'他的','or':'或者','right':'正确的，对的','hat':'（常指带橼的）帽子','her':'她的'}
    si = {'bedroom':'卧室','living room':'客厅,起居室','study':'书房','kitchen':'厨房','bathroom':'浴室;洗手间','bed':'床','phone':'电话','table':'桌子','sofa':'长沙发','fridge':'冰箱','find':'找到','them':'他（她，它）们（宾格）'}
    wu = {'beef':'牛肉','chicken':'鸡肉','noodles':'面条','soup':'汤','vegetable':'蔬菜','chopsticks':'筷子','bowl':'碗','fork':'餐叉','knife':'刀','spoon':'勺','dinner':'（中午或晚上吃的）正餐','ready':'准备好','help yourself':'为（自己）取用','pass':'给，递','try':'试；尝试'}
    liu = {'parents':'父母','cousin':'同辈表亲（或堂亲）','uncle':'舅父；叔父；伯父；姑父；姨父','aunt':'姑母；姨母','baby brother':'婴儿小弟弟','doctor':'医生','cook':'厨师','driver':'司机','farmer':'农民','nurse':'护士','people':'人们','but':'但是','little':'小的','puppy':'小狗','football player':'足球运动员','job':'工作','basketball':'篮球'}
    e = {0:yi,1:er,2:san,3:si,4:wu,5:liu}
    def q(v):
        global r,x,y,o,g,t,h,t,m,cuowu,cuo
        dict_key_ls = list(v.keys())
        random.shuffle(dict_key_ls)
        new_dic = {}
        for key in dict_key_ls:
            new_dic[key] = v.get(key)
        v = new_dic
        for i in v:
            cuowu = v[i]
            if cuowu == "讲台":
                q = input(cuowu+"：")
                w = i 
            else:
                q = input(cuowu+'：')
                w = i 
            if q == w:
                print('对喽！')
                r += 1
            else:
                print('错啦错啦！')
                t[cuowu] = w
                x += 1
        print('结束！')
        print('一共对',r,'道，错',x,'道')
        if x != 0:
            cuo += 1
            print('\n不扎实',x,'道！巩固错题：')
            x = 0
            for i in t:
                if i == "讲台":
                    q = input(i + "：")
                    w = i 
                else:
                    q = input(i + '：')
                    w = i
                w = t[i]
                if q == w:
                    print('对喽！')
                    y += 1
                else:
                    print('错啦错啦！')
                    o += 1
                    m += 1
                    x += 1
                    h[i] = w
            print('结束！')
            print('一共对',y,'道，错',o,'道')
        r = 0
        c = 0
        y = 0
        o = 0
        x = 0
        t = {}
    for l in range(g):
        print('\n第',l+1,'单元！\n')
        v = e[l]
        q(v)
    if m != 0:
        html = open('cuowu.txt','r')
        php = html.read()
        html.close()
        go = open('cuowu.txt','a')
        print('\n错题答案：共',m,'个二错单词\n')
        for i in h:
            d = h[i]
            print(i , d)
            if i not in php or d not in php:
                go.write("'")
                go.write(i)
                go.write("'")
                go.write(':')
                go.write("'")
                go.write(d)
                go.write("'")
                go.write(',\n')
        go.close()
    time.sleep(10)